using GraphQLDemo.Domain.Orders;

namespace GraphQLDemo.Infrastructure.Repositories
{
    public class OrderRepository : IOrderRepository
    {
        public Task<Order> GetAsync(Guid id)
        {
            Console.WriteLine("Execute OrderRepository-GetAsync");

            var order = new Order()
            {
                Id = Guid.NewGuid(),
                CreationTime = DateTime.Now,
                Number = "1001",
                Price = 99,
                StatusType = StatusType.Executing,
                CompanyId = Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340000"),
            };
            return Task.FromResult(order);
        }

        public Task<List<Order>> GetListAsync()
        {
            Console.WriteLine("Execute OrderRepository-GetListAsync");

            var orders = new List<Order>()
            {
                new Order()
                {
                    Id = Guid.NewGuid(),
                    CreationTime = DateTime.Now,
                    Number = "1001",
                    Price = 99,
                    StatusType = StatusType.Executing,
                    CompanyId = Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340000"),
                },
                new Order()
                {
                    Id = Guid.NewGuid(),
                    CreationTime = DateTime.Now,
                    Number = "1002",
                    Price = 100,
                    StatusType = StatusType.Complete,
                    CompanyId = Guid.Parse("57CFDDA8-81A6-4758-ABEF-4C69CA340001"),
                }
            };

            return Task.FromResult(orders);
        }
    }
}
